<body>
    <form id="my-form">
        <div id="tools" class="datagrid-toolbar">
            <a id="subBtn" name="subOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-save"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-save l-btn-icon-left">保存</span></span></a>
            <a id="closeBtn" name="backOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a>
            <input type="hidden" name="financeApprovalId" id="financeApprovalId" value="">
        </div>
        <p id="errorMsg" style="color:red;margin-top:5px;"></p>
        <table class="formTable">
            <tbody>
                <tr>
                    <td class="tdc1">
                        款项用途：
                    </td>
                    <td>
                        <!--<select name="paymentContentId" id="paymentContentId" data-options="required:true">
							<option value='' >==请选择==</option>
						</select>
					-->
                        <input type="text" name="paymentContent" id="paymentContent" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        发票张数：
                    </td>
                    <td>
                        <input type="text" id="amount" data-options="required:true"
                            class="easyui-numberbox numberbox-f validatebox-text" numberboxname="amount"><input
                            type="hidden" name="amount" value="1">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        金额：
                    </td>
                    <td>
                        <input type="text" id="money" data-options="required:true" precision="2"
                            class="easyui-numberbox numberbox-f validatebox-text" numberboxname="money"><input
                            type="hidden" name="money" value="35000">
                    </td>
                </tr>

            </tbody>
        </table>
        <div style="margin-left:10px;">
            <input type="hidden" name="objectId" id="objectId" value="">
            <div id="easyContainer"><input type="file" multiple="" class="fileInput" style="display:none;"><a
                    class="formBtn" id="btu_" style="color:#8C8686;" href="javascript:void(0);">上传</a>
                <div class="flist" style="margin-top: 0px;">
                    <div class="flist-item" style="margin-top:5px;margin-bottom:5px;">333.png&nbsp;&nbsp;<a
                            style="font-size: 14px;color:#23ccb7"
                            href="javascript:downloadFile('783737');">下载</a>&nbsp;&nbsp;&nbsp;&nbsp;<a
                            href="javascript:;" onclick="deleteFile(this,'783737')"
                            style="color:#23ccb7;">删除</a>&nbsp;&nbsp;&nbsp;&nbsp;</div>
                </div>
            </div>
        </div>
    </form>


    <script>

        function checkFormMe(form) {
            var isUpload = $("#isUpload").val();
            if (isUpload == "0") {
                $.messager.alert("提示", "请上传发票图片!", 'info');
                return false;
            } else {
                return $('#my-form').form('validate');
            }
        }

        var financeApprovalId = $.getUrlParam("financeApprovalId");
        if (financeApprovalId != null) {
            $("#financeApprovalId").val(financeApprovalId);
        }

        function showPaymentContentId(paymentContentId) {
            $.ajax({
                type: "POST",
                url: contextPath + "manager/dictionary/118/list",
                data: null,
                dataType: "json",
                success: function (data) {
                    var shtml = "<option value=''>==请选择==</option>";
                    if (data) {
                        for (var i = 0; i < data.length; i++) {
                            if (data[i].id == paymentContentId) {
                                shtml += "<option value='" + data[i].id + "' selected='selected'>" + data[i].name + "</option>";
                            } else {
                                shtml += "<option value='" + data[i].id + "'>" + data[i].name + "</option>";
                            }
                        }
                        $("#paymentContentId").html(shtml);
                    } else {
                        $("#paymentContentId").html(shtml);
                    }
                },
                error: function (response) {

                }

            });
        }

        var objectId = new Date().getTime();
        $("#objectId").val(objectId);
        var BaseModel = Backbone.Model.extend({ urlRoot: contextPath + 'manager/financeDetail' });
        var baseModel;
        var p_id = $.getUrlParam("id");

        if (p_id == null) {
            baseModel = new BaseModel();
            ///showPaymentContentId("");
        } else {
            baseModel = new BaseModel({ id: p_id, i: new Date().getTime() });
            objectId = p_id;
            $("#objectId").val(p_id);
        }
        var baseView = new BaseView({ el: $("#my-form"), model: baseModel });
        if (p_id != null) {
            baseView.doLoad(function (model, response, options) {
                ///showPaymentContentId(model.get("paymentContentId"));
                loadShowFile(model.get("id"), 901, '#easyContainer', 'flist');
            });
        }

        //附件
        $('#easyContainer').easyUpload({
            fileTypes: 'all',//all,image,file
            selectText: "上传",//上传按钮文案
            multi: true,//是否允许多文件上传
            maxNum: 20,//文件上传最大个数
            maxNote: '最多可以上传20个文件，已超出最大上传个数，无法上传！',
            showType: "flist",//展示方。flist,imglist
            fileNote: '文件格式错误，只能上传以下格式',//文件上传说明
            url: contextPath + 'affix',//上传文件地址
            ajaxType: 'POST',//POST,GET
            fileName: 'file',//文件配置参数
            timeout: 300000,//请求超时时间
            formParam: { "objectId": objectId, "objectType": 901 },
        });

    </script>
    <div id="loading1"
        style="position: absolute; left: 0px; top: 0px; width: 100%; height: 703px; background: rgb(232, 232, 232); opacity: 0.5; z-index: 10000; display: none;">
    </div>
    <div id="loading2" class="panel-loading"
        style="position: fixed; top: 38%; left: 41%; border: 2px solid rgb(149, 184, 231); width: 160px; font-size: 14px; z-index: 10001; background: url(&quot;/system/jquery/themes/themes1/images/loading-1.gif&quot;) 10px 8px no-repeat rgb(255, 255, 255); display: none;">
        正在处理，请稍等...</div>
</body>